home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 318 / utilsrc / make-4 < prev    next >
Encoding:
Text File  |  1988-10-20  |  30.8 KB  |  795 lines

  1.  
  2. File: make,  Node: Automatic,  Next: Pattern Match,  Prev: Pattern Examples,  Up: Pattern Rules
  3.  
  4. Automatic Variables
  5. -------------------
  6.  
  7. Suppose you are writing a pattern rule to compile a `.c' file into a `.o'
  8. file: how do you write the `cc' command so that it operates on the right
  9. source file name?  You can't write the name in the command, because the
  10. name is different each time the implicit rule is applied.
  11.  
  12. What you do is use a special feature of `make', the "automatic variables". 
  13. These variables have values computed afresh for each rule that is executed,
  14. based on the target and dependencies of the rule.  In this example, you
  15. would use `$@' for the object file name and `$<' for the source file name.
  16.  
  17. Here is a table of automatic variables:
  18.  
  19. `$@'
  20.      The file name of the target of the rule.  If the target is an archive
  21.      member, then `$@' is the name of the archive file.
  22.  
  23. `$%'
  24.      The target member name, when the target is an archive member.  For
  25.      example, if the target is `foo.a(bar.o)' then `$%' is `bar.o' and `$@'
  26.      is `foo.a'.  `$%' is empty when the target is not an archive member.
  27.  
  28. `$<'
  29.      The name of the first dependency.
  30.  
  31. `$?'
  32.      The names of all the dependencies that are newer than the target, with
  33.      spaces between them.
  34.  
  35. `$^'
  36.      The names of all the dependencies, with spaces between them.
  37.  
  38. `$*'
  39.      The stem with which an implicit rule matches (*Note Pattern Match::.).
  40.       If the target is `dir/a.foo.b' and the target pattern is `a.%.b' then
  41.      the stem is `dir/foo'.  The stem is useful for constructing names of
  42.      related files.
  43.  
  44. `$?' is useful even in explicit rules when you wish to operate on only the
  45. dependencies that have changed.  For example, suppose that an archive named
  46. `lib' is supposed to contain copies of several object files.  This rule
  47. copies just the changed object files into the archive:
  48.  
  49.      lib: foo.o bar.o lose.o win.o
  50.              ar c lib $?
  51.  
  52.  Of the variables listed above, four have values that are single file names.
  53.  These four have variants that get just the file's directory name or just
  54. the file name within the directory.  The variant variables' names are
  55. formed by appending `D' or `F', respectively.  These variants are
  56. semi-obsolete in GNU `make' since the functions `dir' and `notdir' can be
  57. used to get an equivalent effect (*Note Filename Functions::.).  Here is a
  58. table of the variants:
  59.  
  60. `$(@D)'
  61.      The directory part of the file name of the target.  If the value of
  62.      `$@' is `dir/foo.o' then `$(@D)' is `dir/'.  This value is `./' if
  63.      `$@' does not contain a slash.  `$(@D)' is equivalent to `$(dir $@)'.
  64.  
  65. `$(@F)'
  66.      The file-within-directory part of the file name of the target.  If the
  67.      value of `$@' is `dir/foo.o' then `$(@F)' is `foo.o'.  `$(@F)' is
  68.      equivalent to `$(notdir $@)'.
  69.  
  70. `$($/)'
  71.      The same as `$(@F)', for compatibility with some other versions of
  72.      `make'.
  73.  
  74. `$(%D)'
  75. `$(%F)'
  76.      The directory part and the file-within-directory part of the archive
  77.      member name.
  78.  
  79. `$(*D)'
  80. `$(*F)'
  81.      The directory part and the file-within-directory part of the stem;
  82.      `dir/' in this example.
  83.  
  84. `$(<D)'
  85. `$(<F)'
  86.      The directory part and the file-within-directory part of the first
  87.      implicit dependency.
  88.  
  89. File: make,  Node: Pattern Match,  Next: Match-Anything Rules,  Prev: Automatic,  Up: Pattern Rules
  90.  
  91. How Patterns Match
  92. ------------------
  93.  
  94. A target pattern is composed of a `%' between a prefix and a suffix, either
  95. of which may be empty.  The pattern matches a file name only if the file
  96. name starts with the prefix and ends with the suffix, without overlap.  The
  97. text between the prefix and the suffix is called the "stem".  Thus, when
  98. the pattern `%.o' matches the file name `test.o', the stem is `test'.  The
  99. pattern rule dependencies are turned into actual file names by substituting
  100. the stem for the character `%'.  Thus, if in the same example one of the
  101. dependencies is written as `%.c', it expands to `test.c'.
  102.  
  103. When the target pattern does not contain a slash (and usually it does not),
  104. directory names in the file names are removed from the file name before it
  105. is compared with the target prefix and suffix.  The directory names, along
  106. with the slash that ends them, are added back to the stem.  Thus, `e%t'
  107. does match the file name `src/eat', with `src/a' as the stem.  When
  108. dependencies are turned into file names, the directories from the stem are
  109. added at the front, while the rest of the stem is substituted for the `%'. 
  110. The stem `src/a' with a dependency pattern `c%r' gives the file name
  111. `src/car'.
  112.  
  113. File: make,  Node: Match-Anything Rules,  Next: Canceling Rules,  Prev: Pattern Match,  Up: Pattern Rules
  114.  
  115. Match-Anything Pattern Rules
  116. ----------------------------
  117.  
  118. When a pattern rule's target is just `%', it matches any filename whatever.
  119.  We call these rules "match-anything" rules.  They are very useful, but it
  120. can take a lot of time for `make' to think about them, because it must
  121. consider every such rule for each file name listed either as a target or as
  122. a dependency.
  123.  
  124. Suppose the makefile mentions `foo.c'.  For this target, `make' would have
  125. to consider making it by linking an object file `foo.c.o', or by C
  126. compilation-and-linking in one step from `foo.c.c', or by Pascal
  127. compilation-and-linking from `foo.c.p', and many other possibilities.  We
  128. know these possibilities are ridiculous since `foo.c' is a C source file,
  129. not an executable.
  130.  
  131. If `make' did consider these possibilities, it would ultimately reject
  132. them, because files such as `foo.c.o', `foo.c.p', etc. would not exist. 
  133. But these possibilities are so numerous that `make' would run very slowly
  134. if it had to consider them.
  135.  
  136. To gain speed, we have put various constraints on the way `make' considers
  137. match-anything rules.  There are two different constraints that can be
  138. applied, and each time you define a match-anything rule you must choose one
  139. or the other for that rule.
  140.  
  141. One choice is to mark the match-anything rule as "terminal" by defining it
  142. with a double colon.  When a rule is terminal, it does not apply unless its
  143. dependencies actually exist.  Dependencies that could be made with other
  144. implicit rules are not good enough.
  145.  
  146. For example, the built-in implicit rules for extracting sources from RCS
  147. and SCCS files are terminal; as a result, if the file `foo.c,v' does not
  148. exist, `make' will not even consider trying to make it as an intermediate
  149. file from `foo.c,v.o' or from `RCS/SCCS/s.foo.c,v'.  RCS and SCCS files are
  150. generally ultimate source files, which should not be remade from any other
  151. files; therefore, `make' can save time by not looking for ways to remake
  152. them.
  153.  
  154. If you do not mark the match-anything rule as terminal, then it is
  155. nonterminal.  A nonterminal match-anything rule cannot apply to a file name
  156. that indicates a specific type of data.  A file name indicates a specific
  157. type of data if some non-match-anything implicit rule target matches it.
  158.  
  159. For example, the file name `foo.c' matches the target for the pattern rule
  160. `%.c : %.y' (the rule to run Yacc).  Regardless of whether this rule is
  161. actually applicable (which happens only if there is a file `foo.y'), the
  162. fact that its target matches is enough to prevent consideration of any
  163. nonterminal match-everything rules for the file `foo.c'.  Thus, `make' will
  164. not even consider trying to make `foo.c' as an executable file from
  165. `foo.c.o', `foo.c.c', `foo.c.p', etc.
  166.  
  167. The motivation for this constraint is that nonterminal match-everything
  168. rules are used for making files containing specific types of data (such as
  169. executable files) and a file name with a recognized suffix indicates a
  170. specific different type of data (such as a C source file).
  171.  
  172. Special built-in dummy pattern rules are provided solely to recognize
  173. certain file names so that nonterminal match-everything rules won't be
  174. considered.  These dummy rules have no dependencies and no commands, and
  175. they are ignored for all other purposes.  For example, the built-in
  176. implicit rule
  177.  
  178.      %.p :
  179.  
  180. exists to make sure that Pascal source files such as `foo.p' match a
  181. specific target pattern and thereby prevent time from being wasted looking
  182. for `foo.p.o' or `foo.p.c'.
  183.  
  184. File: make,  Node: Canceling Rules,  Prev: Match-Anything Rules,  Up: Pattern Rules
  185.  
  186. Canceling Implicit Rules
  187. ------------------------
  188.  
  189. You can override a built-in implicit rule by defining a new pattern rule
  190. with the same target and dependencies, but different commands.  When the
  191. new rule is defined, the built-in one is replaced.  The new rule's position
  192. in the sequence of implicit rules is determined by where you write the new
  193. rule.
  194.  
  195. You can cancel a built-in implicit rule by defining a pattern rule with the
  196. same target and dependencies, but no commands.  For example, the following
  197. would cancel the rule that runs the assembler:
  198.  
  199.      %.o : %.s
  200.  
  201. File: make,  Node: Last Resort,  Next: Suffix Rules,  Prev: Pattern Rules,  Up: Implicit
  202.  
  203. Defining Last-Resort Default Rules
  204. ==================================
  205.  
  206. You can define a last-resort implicit rule by writing a rule for the target
  207. `.DEFAULT'.  Such a rule's commands are used for all targets and
  208. dependencies that have no commands of their own and for which no other
  209. implicit rule applies.  Naturally, there is no `.DEFAULT' rule unless you
  210. write one.
  211.  
  212. For example, when testing a makefile, you might not care if the source
  213. files contain real data, only that they exist.  Then you might do this:
  214.  
  215.      .DEFAULT:
  216.              touch $@
  217.  
  218. to cause all the source files needed (as dependencies) to be created
  219. silently.
  220.  
  221. File: make,  Node: Suffix Rules,  Next: Search Algorithm,  Prev: Last Resort,  Up: Implicit
  222.  
  223. Old-Fashioned Suffix Rules
  224. ==========================
  225.  
  226. "Suffix rules" are the old-fashioned way of defining implicit rules for
  227. `make'.  Suffix rules are obsolete because pattern rules are more general
  228. and clearer.  They are supported in GNU `make' for compatibility with old
  229. makefiles.  They come in two kinds: "double-suffix" and "single-suffix".
  230.  
  231. A double-suffix rule is defined by a pair of suffixes: the target suffix
  232. and the source suffix.  It matches any file whose name ends with the target
  233. suffix.  The corresponding implicit dependency is to the file name made by
  234. replacing the target suffix with the source suffix.  A two-suffix rule
  235. whose target and source suffixes are `.o' and `.c' is equivalent to the
  236. pattern rule `%.o : %.c'.
  237.  
  238. A single-suffix rule is defined by a single suffix, which is the source
  239. suffix.  It matches any file name, and the corresponding implicit
  240. dependency name is made by appending the source suffix.  A single-suffix
  241. rule whose source suffix is `.c' is equivalent to the pattern rule `% : %.c'.
  242.  
  243. Suffix rule definitions are recognized by comparing each rule's target
  244. against a defined list of known suffixes.  When `make' sees a rule whose
  245. target is a known suffix, this rule is considered a single-suffix rule. 
  246. When `make' sees a rule whose target is two known suffixes concatenated,
  247. this rule is taken as a double-suffix rule.
  248.  
  249. For example, `.c' and `.o' are both on the default list of known suffixes. 
  250. Therefore, if you define a rule whose target is `.c.o', `make' takes it to
  251. be a double-suffix rule with source suffix `.c' and target suffix `.o'. 
  252. For example, here is the old fashioned way to define the rule for compiling
  253. a C source:
  254.  
  255.      .c.o:
  256.              $(CC) -c $(CFLAGS) -o $@ $<
  257.  
  258. The known suffixes are simply the names of the dependencies of the special
  259. target `.SUFFIXES'.  You can add your own suffixes by writing a rule for
  260. `.SUFFIXES' that adds more dependencies, as in
  261.  
  262.      .SUFFIXES: .hack .win
  263.  
  264. which adds `.hack' and `.win' to the end of the list of suffixes.
  265.  
  266. If you wish to eliminate the default known suffixes instead of just adding
  267. to them, write a rule for `.SUFFIXES' with no dependencies.  By special
  268. dispensation, this eliminates all existing dependencies of `.SUFFIXES'. 
  269. You can then write another rule to add the suffixes you want.  For example,
  270.  
  271.      .SUFFIXES:    # Delete the default suffixes
  272.      .SUFFIXES: .c .o .h   # Define our suffix list
  273.  
  274. The `-r' flag causes the default list of suffixes to be empty.
  275.  
  276. File: make,  Node: Search Algorithm,  Prev: Last Resort,  Up: Implicit
  277.  
  278. Implicit Rule Search Algorithm
  279. ==============================
  280.  
  281. Here is the procedure `make' uses for searching for an implicit rule for a
  282. target T.  This procedure is followed for each double-colon rule with no
  283. commands, for each target of ordinary rules none of which have commands,
  284. and for each dependency that is not the target of any rule.  It is also
  285. followed recursively for dependencies that come from implicit rules, in the
  286. search for a chain of rules.
  287.  
  288. Suffix rules are not mentioned in this algorithm because suffix rules are
  289. converted to equivalent pattern rules after the makefiles have been read in.
  290.  
  291. For an archive member target of the form `ARCHIVE(MEMBER)', the following
  292. algorithm is run twice, first using `(MEMBER)' as the target T, and second
  293. using the entire target if the first run found no rule.
  294.  
  295.   1. Split T into a directory part, called D, and the rest, called N.  For
  296.      example, if T is `src/foo.o', then D is `src/' and N is `foo.o'.
  297.  
  298.   2. Make a list of the pattern rules whose target matches T or N.  If the
  299.      target pattern contains a slash, it is matched against T; otherwise,
  300.      against N.
  301.  
  302.   3. If any rule in that list is *not* a match-anything rule, then remove all
  303.      nonterminal match-anything rules from the list.
  304.  
  305.   4. Remove any rules with no dependencies from the list.
  306.  
  307.   5. For each pattern rule in the list:
  308.  
  309.        1. Find the stem S: the part of T or N that the `%' in the target pattern
  310.           matches.
  311.  
  312.        2. Compute the dependency names by substituting S for `%'; if the target
  313.           pattern does not contain a slash, D is appended to the front of
  314.           each dependency name.
  315.  
  316.        3. Test whether all the dependencies exist or ought to exist.  (If a file
  317.           name mentioned in the makefile as a target or as an explicit
  318.           dependency then we say it ought to exist.)
  319.  
  320.           If all dependencies exist or ought to exist, then this rule
  321.           applies.
  322.  
  323.   6. If no pattern rule has been found so far, try harder.  For each pattern
  324.      rule in the list:
  325.  
  326.        1. If the rule is a terminal match-anything rule, ignore it and go on to
  327.           the next rule.
  328.  
  329.        2. Compute the dependency names as before.
  330.  
  331.        3. Test whether all the dependencies exist or ought to exist.
  332.  
  333.        4. For each dependency that does not exist, follow this algorithm
  334.           recursively to see if the dependency can be made by an implicit
  335.           rule.
  336.  
  337.        5. If all dependencies exist, ought to exist, or can be made by implicit
  338.           rules, then this rule applies.
  339.  
  340.   7. If no rule has been found so far, this target cannot be made by an
  341.      implicit rule.  Return failure.
  342.  
  343.   8. If no implicit rule applies, the rule for `.DEFAULT', if any, applies. 
  344.      In that case, give T the same commands that `.DEFAULT' has. 
  345.      Otherwise, there are no commands for T.
  346.  
  347. When the commands of a pattern rule are executed for T, the automatic
  348. variables `$@', `$*' and `$<' are set as follows:
  349.  
  350. `$@'
  351.      T`$*'
  352.      If the target pattern contains a slash, this is S; otherwise, it is DS.
  353. `$<'
  354.      The name of the first dependency that came via the implicit rule.
  355.  
  356. For `.DEFAULT' commands, as for non-implicit commands, `$*' and `$<' are
  357. empty.  `$@' is T, as always.
  358.  
  359. File: make,  Node: Archives,  Next: Features,  Prev: Implicit,  Up: Top
  360.  
  361. Using `make' to Update Archive Files
  362. ************************************
  363.  
  364. "Archive files" are files containing named subfiles called "members"; they
  365. are maintained with the program `ar' and their main use is as subroutine
  366. libraries for linking.
  367.  
  368. * Menu:
  369.  
  370. * Members: Archive Members.    How to name an archive member
  371.                 as a target or dependency.
  372. * Update: Archive Update.      An implicit rule can update
  373.                 most archive member targets just right.
  374. * Symbols: Archive Symbols.    Another implicit rule runs `ranlib'
  375.                 to update the special member `__.SYMDEF'.
  376.  
  377.  
  378. File: make,  Node: Archive Members,  Next: Archive Update,  Prev: Archives,  Up: Archives
  379.  
  380. Archive Members as Targets
  381. ==========================
  382.  
  383. An individual member of an archive file can be used as a target or
  384. dependency in `make'.  The archive file must already exist, but the member
  385. need not exist.  You specify the member named MEMBER in archive file
  386. ARCHIVE as follows:
  387.  
  388.      ARCHIVE(MEMBER)
  389.  
  390. This construct is available only in targets and dependencies, not in
  391. commands!  Most programs that you might use in commands do not support this
  392. syntax and cannot act directly on archive members.  Only `ar' and other
  393. programs specifically designed to operate on archives can do so. 
  394. Therefore, valid commands to update an archive member target probably must
  395. use `ar'.  For example, this rule says to create a member `hack.o' in
  396. archive `foolib' by copying the file `hack.o':
  397.  
  398.      foolib(hack.o) : hack.o
  399.              ar r foolib hack.o
  400.  
  401. In fact, nearly all archive member targets are updated in just this way and
  402. there is an implicit rule to do it for you.
  403.  
  404. File: make,  Node: Archive Update,  Next: Archive Symbols,  Prev: Archive Members,  Up: Archives
  405.  
  406. Implicit Rule for Archive Member Targets
  407. ========================================
  408.  
  409. Recall that a target that looks like `A(M)' stands for the member named M
  410. in the archive file A.
  411.  
  412. When `make' looks for an implicit rule for such a target, as a special
  413. feature it considers implicit rules that match `(M)', as well as those that
  414. match the actual target `A(M)'.
  415.  
  416. This causes one special rule whose target is `(%)' to match.  This rule
  417. updates the target `A(M)' by copying the file M into the archive.  For
  418. example, it will update the archive member target `foo.a(bar.o)' by copying
  419. the *file* `bar.o' into the archive `foo.a' as a member named `bar.o'.
  420.  
  421. When this rule is chained with others, the result is very powerful.  Thus,
  422. `make "foo.a(bar.o)"' in the presence of a file `bar.c' is enough to cause
  423. the following commands to be run, even without a makefile:
  424.  
  425.      cc -c bar.c -o bar.o
  426.      ar r foo.a bar.o
  427.      rm -f bar.o
  428.  
  429. Here the file `bar.o' has been envisioned as an intermediate file.
  430.  
  431. File: make,  Node: Archive Symbols,  Prev: Archive Update,  Up: Archives
  432.  
  433. Updating Archive Symbol Directories
  434. -----------------------------------
  435.  
  436. An archive file that is used as a library usually contains a special member
  437. named `__.SYMDEF' that contains a directory of the external symbol names
  438. defined by all the other members.  After you update any other members, you
  439. need to update `__.SYMDEF' so that it will summarize the other members
  440. properly.  This is done by running the `ranlib' program:
  441.  
  442.      ranlib ARCHIVEFILE
  443.  
  444. Normally you would put this command in the rule for the archive file, and
  445. make all the members of the archive file dependents of that rule.  For
  446. example,
  447.  
  448.      libfoo.a: libfoo.a(x.o) libfoo.a(y.o) ...
  449.              ranlib libfoo.a
  450.  
  451. The effect of this is to update archive members `x.o', `y.o', etc., and
  452. then update the symbol directory member `__.SYMDEF' by running `ranlib'. 
  453. The rules for updating the members are not shown here; most likely you can
  454. omit them and use the implicit rule which copies files into the archive, as
  455. described in the preceding section.
  456.  
  457. File: make,  Node: Features,  Next: Missing,  Prev: Archives,  Up: Top
  458.  
  459. Features of GNU `make'
  460. **********************
  461.  
  462. GNU `make' contains many features not in any other `make' program.  Some of
  463. them are taken from other versions of `make', while most are new inventions
  464. of the implementors of GNU `make'.
  465.  
  466. The standard for comparison among versions of `make' in this chapter will
  467. be the version found in standard 4.2 BSD Unix systems.  Many additions come
  468. from the versions of `make' found in other Unix systems.  This chapter
  469. lists the features of GNU `make' beyond the 4.2 BSD version.  They are
  470. presented as a simple list of small items with terse descriptions.  All of
  471. these features (as well as those found in 4.2 BSD `make') are documented in
  472. this manual, so it would be redundant to repeat that documentation here.
  473.  
  474. The `VPATH' variable and its special meaning come from the `make' in 4.3
  475. BSD Unix.  *note Directory Search::.
  476.  
  477. Many features come from the version of `make' in Sun Unix systems.  I
  478. believe that these in turn are adopted from the `make' in Unix System V.
  479.  
  480.    * Included makefiles.  *note Include::.
  481.  
  482.    * Variables are read in from the environment.  All variables are placed
  483.      into the environment of child processes (running commands).  *note
  484.      Environment::.  Note also the `-e' option.
  485.  
  486.    * The environment variable `MAKEFLAGS' is scanned for command-line
  487.      options to `make'.  The options `-f', `-p', `-d' and `-c' are not
  488.      accepted.  The `make' variable `MAKEFLAGS' is set to a list of the
  489.      options `make' was invoked with, except those noted above.  *note
  490.      Options/Recursion::.
  491.  
  492.    * The automatic variable `$%' is set to the member name in an archive
  493.      reference.  *note Automatic::.
  494.  
  495.    * The automatic variables `$@', `$*', `$<' and `$%' have corresponding
  496.      forms such as `$(@F)' and `$(@D)' which with only the filename and
  497.      only the directory.  *note Automatic::.
  498.  
  499.    * Substitution variable references.  *note Reference::.
  500.  
  501.    * The command-line options `-b' and `-m' are accepted and ignored.
  502.  
  503.    * Targets whose commands contain a reference to the variable `MAKE' have
  504.      their commands executed even if the `-n', `-q' or `-t' options are
  505.      specified.  *note Recursion::.  I'm told that Unix System V `make'
  506.      does this only in the case of `-n'.
  507.  
  508.    * An implicit suffix rule `X.a:' makes `LIB(NAME.o)' from `NAME.X'.  In
  509.      GNU `make', this is actually implemented by using one pattern rule for
  510.      making library-archive files and rule-chaining.  *note Chained Rules::.
  511.  
  512. The Sun Unix (and probably System V) version of `make' fails to support
  513. variable references using braces (`{' and `}') rather than parantheses
  514. (*Note Reference::.), and to set the `MFLAGS' variable to the list of
  515. options (the same list as in `MAKEFLAGS').
  516.  
  517. The remaining new features are inventions new to GNU `make'.
  518.  
  519.    * The arrangement of lines and backslash-newline combinations in
  520.      commands is retained when the commands are printed, so they appear as
  521.      they do in the makefile, except for the stripping of initial whitespace.
  522.  
  523.    * The `-v' option prints version and copyright information.
  524.  
  525.    * Simply-expanded variables.  *note Flavors::.
  526.  
  527.    * The variable `MAKEOVERRIDES' is defined to contain all the variable
  528.      definitions given on the command line, and is appended to the `MAKE'
  529.      variable which contains the name by which `make' was invoked.  Thus,
  530.      sub-makes will always get variable definitions from the command line
  531.      that cannot come from the environment since environment variable
  532.      definitions do not override those in makefiles.
  533.  
  534.    * The `-c' to change directory.  *note Options::.
  535.  
  536.    * Verbatim variable definitions made with `define'.  *note Defining::.
  537.  
  538.    * Phony targets.  *note Phony Targets::.
  539.  
  540.    * Variable expansion functions.  *note Functions::.
  541.  
  542.    * The `-o' option makes files seem artificially old.  *note Avoid
  543.      Compilation::.
  544.  
  545.    * Conditional lines.  *note Conditionals::.
  546.  
  547.    * Included makefiles never determine the default target.
  548.  
  549.    * There is an include file search path.  *note Include::.
  550.  
  551.    * *note MAKEFILES Variable::.
  552.  
  553.    * *note Pattern Rules::.
  554.  
  555.    * The automatic variable `$^' contains a list of all dependencies of the
  556.      current target.  *note Automatic::.
  557.  
  558.    * There is a fully complete default set of implicit rules using file
  559.      with suffixes `.out', `.a', `.o', `.s', `.c', `.f', `.p', `.F', `.e',
  560.      `.r', `.y', `.ye', `.yr' and `.l'.  *note Catalogue of Rules::.
  561.  
  562.    * Leading sequences of `./' are stripped from file names, so that
  563.      `./FILE' and `FILE' are considered to be the same file.
  564.  
  565.    * Dependencies of the form `-lNAME' are searched for as library
  566.      archives.  *note Libraries/Search::.
  567.  
  568.    * Suffixes for suffix rules (*Note Suffix Rules::.) may contain any
  569.      characters.  In other version of `make', they must begin with `.' and
  570.      not contain any `/' characters.
  571.  
  572.    * The variable `MAKELEVEL' keeps track of the current level of `make'
  573.      recursion.  At the top level (`MAKELEVEL' is zero), the `SHELL'
  574.      environment variable is not used to execute commands.  It is reset to
  575.      `/bin/sh'.
  576.  
  577.    * Intermediate implicit files.  *note Chained Rules::.
  578.  
  579.    * Selective `vpath' search.  *note Directory Search::.
  580.  
  581. File: make,  Node: Missing,  Next: Concept Index,  Prev: Features,  Up: Top
  582.  
  583. Missing Features in GNU `make'
  584. ******************************
  585.  
  586. The `make' programs in various other systems support three features that
  587. are not implemented in GNU `make'.
  588.  
  589.    * A target of the form `FILE((ENTRY))' stands for a member of archive
  590.      file FILE.  The member is chosen, not by name, but by being an object
  591.      file which defines the linker symbol ENTRY.
  592.  
  593.      This feature was not put into GNU `make' because of the nonmodularity
  594.      of putting knowledge into `make' of the internal format of archive
  595.      file symbol directories.  *note Archive Symbols::.
  596.  
  597.    * Suffixes (used in suffix rules) that end with the character `~' have a
  598.      special meaning; they refer to the SCCS file that corresponds to the
  599.      file one would get without the `~'.  For example, the suffix rule
  600.      `.c~.o' would make the file `N.o' file from the SCCS file `s.N.c'. 
  601.      For complete coverage, a whole series of such suffix rules is
  602.      required.  *note Suffix Rules::.
  603.  
  604.      In GNU `make', this entire series of cases is handled by two pattern
  605.      rules for extraction from SCCS, in combination with the general
  606.      feature of rule chaining.  *note Chained Rules::.
  607.  
  608.    * In System V `make', the string `$$@' has the strange meaning that, in
  609.      the dependencies of a rule with multiple targets, it stands for the
  610.      particular target that is being processed.
  611.  
  612.      This is not defined in GNU `make' because `$$' should always stand for
  613.      an ordinary `$'.
  614.  
  615.      It is possible to get this functionality through the use of static
  616.      pattern rules.  The System V `make' rule:
  617.  
  618.           $(targets): $$@.o lib.a
  619.  
  620.      can be replaced with the GNU `make' static pattern rule:
  621.  
  622.           $(targets): %: %.o lib.a
  623.  
  624. File: make,  Node: Concept Index,  Next: Name Index,  Prev: Missing,  Up: Top
  625.  
  626. Index of Concepts
  627. *****************
  628.  
  629. * Menu:
  630.  
  631. * $ (function call): Function Syntax.
  632. * $ (variable reference): Reference.
  633. * - (in commands): Errors.
  634. * -i: Errors.
  635. * -k: Testing.
  636. * -k: Errors.
  637. * -n: Echoing.
  638. * -n: Instead of Execution.
  639. * -o: Avoid Compilation.
  640. * -q: Instead of Execution.
  641. * -s: Echoing.
  642. * -t: Instead of Execution.
  643. * :=: Setting.
  644. * =: Setting.
  645. * @ (in commands): Echoing.
  646. * __.SYMDEF: Archive Symbols.
  647. * archive: Archives.
  648. * archive member targets: Archive Members.
  649. * arguments: Function Syntax.
  650. * automatic variables: Automatic.
  651. * chains of rules: Chained Rules.
  652. * commands: Commands.
  653. * comments: Makefile Contents.
  654. * conditionals: Conditionals.
  655. * deletion of target files: Interrupts.
  656. * dependency: Rules.
  657. * directory search: Directory Search.
  658. * double-colon rule: Double-Colon.
  659. * echoing (of commands): Echoing.
  660. * empty targets: Empty Targets.
  661. * environment: Environment.
  662. * environment and recursion: Variables/Recursion.
  663. * error (in commands): Errors.
  664. * execution: Execution.
  665. * file name: Wildcards.
  666. * flags: Options.
  667. * flags for compilers: Implicit Variables.
  668. * flavors (of variables): Flavors.
  669. * function: Functions.
  670. * goal: Goals.
  671. * implicit rule: Implicit.
  672. * intermediate file: Chained Rules.
  673. * interrupt: Interrupts.
  674. * makefile: Makefiles.
  675. * match-anything rule: Match-Anything Rules.
  676. * modified variable reference: Reference.
  677. * options: Options.
  678. * options and recursion: Options/Recursion.
  679. * pattern rule: Pattern Rules.
  680. * phony targets: Phony Targets.
  681. * precious targets: Special Targets.
  682. * recursion: Recursion.
  683. * recursive variable expansion: Variables.
  684. * recursive variable expansion: Flavors.
  685. * recursive variable reference: Reference.
  686. * reference to variables: Reference.
  687. * rule: Rules.
  688. * search path for dependencies: Directory Search.
  689. * sequences of commands: Sequences.
  690. * setting variables: Setting.
  691. * shell: Execution.
  692. * signal: Interrupts.
  693. * silent operation: Echoing.
  694. * simple variable expansion: Variables.
  695. * special targets: Special Targets.
  696. * static pattern rules: Static Pattern.
  697. * stem: Pattern Match.
  698. * substitution variable reference: Reference.
  699. * suffix rules: Suffix Rules.
  700. * target: Rules.
  701. * terminal rule: Match-Anything Rules.
  702. * touch: Instead of Execution.
  703. * value: Variables.
  704. * variable: Variables.
  705. * varying dependencies: Static Pattern.
  706. * vpath: Directory Search.
  707. * wildcard: Wildcards.
  708.  
  709.  
  710. File: make,  Node: Name Index,  Prev: Concept Index,  Up: Top
  711.  
  712. Index of Functions, Directives and Variables
  713. ********************************************
  714.  
  715. * Menu:
  716.  
  717. * .DEFAULT: Last Resort.
  718. * .IGNORE: Errors.
  719. * .PHONY: Phony Targets.
  720. * .PRECIOUS: Interrupts.
  721. * .SILENT: Echoing.
  722. * .SUFFIXES: Suffix Rules.
  723. * AS: Implicit Variables.
  724. * ASFLAGS: Implicit Variables.
  725. * CC: Implicit Variables.
  726. * CFLAGS: Implicit Variables.
  727. * CO: Implicit Variables.
  728. * EFLAGS: Implicit Variables.
  729. * FC: Implicit Variables.
  730. * FFLAGS: Implicit Variables.
  731. * GET: Implicit Variables.
  732. * LDFLAGS: Implicit Variables.
  733. * LEX: Implicit Variables.
  734. * LFLAGS: Implicit Variables.
  735. * MAKE: MAKE Variable.
  736. * MAKEFILES: MAKEFILES Variable.
  737. * MAKEFILES: Variables/Recursion.
  738. * MAKEFLAGS: Options/Recursion.
  739. * MAKELEVEL: Variables/Recursion.
  740. * MFLAGS: Options/Recursion.
  741. * PC: Implicit Variables.
  742. * PFLAGS: Implicit Variables.
  743. * RANLIB: Implicit Variables.
  744. * RFLAGS: Implicit Variables.
  745. * SHELL: Execution.
  746. * VPATH: Directory Search.
  747. * YACC: Implicit Variables.
  748. * YACCE: Implicit Variables.
  749. * YACCR: Implicit Variables.
  750. * YFLAGS: Implicit Variables.
  751. * addprefix: Filename Functions.
  752. * addsuffix: Filename Functions.
  753. * basename: Filename Functions.
  754. * define: Defining.
  755. * dir: Filename Functions.
  756. * else: Conditional Syntax.
  757. * endef: Defining.
  758. * endif: Conditional Syntax.
  759. * filter: Text Functions.
  760. * filter-out: Text Functions.
  761. * findstring: Text Functions.
  762. * firstword: Filename Functions.
  763. * foreach: Foreach Function.
  764. * ifdef: Conditional Syntax.
  765. * ifeq: Conditional Syntax.
  766. * include: Include.
  767. * join: Filename Functions.
  768. * notdir: Filename Functions.
  769. * objects: Simple.
  770. * override: Override Directive.
  771. * patsubst: Text Functions.
  772. * sort: Text Functions.
  773. * strip: Text Functions.
  774. * subst: Text Functions.
  775. * suffix: Filename Functions.
  776. * vpath: Directory Search.
  777. * wildcard: Filename Functions.
  778. * wildcard: Wildcard Function.
  779.  
  780.  
  781.